﻿// Example header text. Can be configured in the options.
using System;
using vtech_frameWorks.Exceptions;

namespace vtech_formBase
{
    public partial class frmListWithGrid : Object.frmObject
    {
        protected Guid ID = Guid.Empty;

        public frmListWithGrid()
        {
            this.InitializeComponent();
        }

        /// <summary>
        ///Ham load data ra cac control 
        /// </summary>
        protected virtual void LoadData()
        {
        }

        protected virtual void frmListWithGrid_Load(object sender, EventArgs e)
        {
            this.LoadData();
        }

        #region Add
        /// <summary>
        /// Thêm mới
        /// </summary>
        protected virtual void Add()
        {
        }

        /// <summary>
        /// Thêm mới
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mnuAdd_Click(object sender, EventArgs e)
        {
            try
            {
                this.Add();
            }
            catch (Exception ex)
            {
                ClsInformation.Error(ex.Message);
            }
        }

        #endregion

        #region Edit
        /// <summary>
        /// Sửa
        /// </summary>
        protected virtual void Edit()
        {
        }

        /// <summary>
        /// Sửa
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mnuEdit_Click(object sender, EventArgs e)
        {
            try
            {
                this.Edit();
            }
            catch (Exception ex)
            {
                ClsInformation.Error(ex.Message);
            }
        }

        #endregion

        #region Delete
        /// <summary>
        /// Xoa
        /// </summary>
        protected virtual void Delete()
        {
        }

        private void mnuDel_Click(object sender, EventArgs e)
        {
            try
            {
                this.Delete();
            }
            catch (Exception ex)
            {
                ClsInformation.Error(ex.Message);
            }
        }

        #endregion

        #region Reload
        /// <summary>
        /// Tải lại
        /// </summary>
        protected virtual void Reload()
        {
        }

        private void mnuReload_Click(object sender, EventArgs e)
        {
            try
            {
                this.Reload();
            }
            catch (Exception ex)
            {
                ClsInformation.Error(ex.Message);
            }
        }

        #endregion

        #region Printer
        /// <summary>
        /// In
        /// </summary>
        protected virtual void Printer()
        {
        }

        private void mnuPrinter_Click(object sender, EventArgs e)
        {
            try
            {
                this.Printer();
            }
            catch (Exception ex)
            {
                ClsInformation.Error(ex.Message);
            }
        }

        #endregion

        #region Search
        /// <summary>
        /// Search
        /// </summary>
        protected virtual void Search()
        {
        }

        private void mnuSearch_Click(object sender, EventArgs e)
        {
            try
            {
                this.Search();
            }
            catch (Exception ex)
            {
                ClsInformation.Error(ex.Message);
            }
        }
        #endregion
    }
}